//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) Microsoft Corporation. All rights reserved.

Module Name:

callctrl.h

Abstract:


Notes:

--*/
/*
----------------------------------------------------------------------------------------------------
    Date                     Author            Activity ID                   Activity Headline
    2007-09-05          zhongchuren   WM600015327              [AIS]fix Bruetooth earphone no sound issue
----------------------------------------------------------------------------------------------------
*/
#pragma once
#include "Wavedev.h"
#include "ststore.h"
#include "snapi.h"
#include "svsutil.hxx"
#include "bt_buffer.h"
#include "bt_ddi.h"


#define CALLCTRL_CMDBUF_LENGTH       (MAX_PATH + MAXLENGTH_ADDRESS + MAXLENGTH_SUBADDR)
#define CALLCTRL_ALLOC_NUMBER        16

//
// Structure used for keeping track of address and calltype of a dialed call.
// Used only when using external calltype determination.
// This global spans the command and notification threads, and must be
// protected using CRITICAL_SECTION g_csDialedCallData.
//
struct DIALEDCALLDATA
{
    BOOL fValid;
    DWORD dwCalltype;
    WCHAR wszAddress [MAXLENGTH_ADDRESS];
};

//
// Structure used for keeping track of the ID and calltype of a ringing call,
// along with flags controlling the sending of ring notifications.
// Used only when using external calltype determination.
// This global spans the command and notification threads, and must be
// protected using CRITICAL_SECTION g_csRingingCallData.
//
struct RINGINGCALLDATA
{
    BOOL fCalltypeValid;
    DWORD dwCalltype;
    BOOL fCallIdValid;
    DWORD dwCallId;
    BOOL fDelayRingNotification;
    BOOL fForceRingNotification;
};

//
// Structure used for keeping track of address and calltype of a waiting call
// Used only when using external calltype determination.
// This global is currently only used in the command thread.  If access is 
// changed to span multiple threads, it must be protected using a 
// CRITICAL_SECTION.
//
struct WAITINGCALLDATA
{
    BOOL fValid;
    DWORD dwCalltype;
    WCHAR wszAddress [MAXLENGTH_ADDRESS];
};

extern BOOL g_fHoldBeforDail;

HRESULT RILDrv_Dial(DWORD dwParam, LPCSTR szAddress, DWORD dwType, DWORD dwOptions);
HRESULT RILDrv_Answer(DWORD dwParam);
HRESULT RILDrv_Hangup(DWORD dwParam);
HRESULT RILDrv_SendDTMF(DWORD dwParam, LPCSTR lpszChars, DWORD dwDuration);
HRESULT RILDrv_GetCallList(DWORD dwParam);
HRESULT RILDrv_ManageCalls(DWORD dwParam, DWORD dwCommand, DWORD dwID);
HRESULT RILDrv_TransferCall(DWORD dwParam, const RILADDRESS* lpAddress, const RILSUBADDRESS* lpSubAddress);
HRESULT RILDrv_GetLineStatus(DWORD dwParam);
HRESULT RILDrv_GetCurrentAddressId(DWORD dwParam);
HRESULT RILDrv_SetCurrentAddressId(DWORD dwParam, DWORD dwAddressId);

HRESULT RILDrv_SendFlash(DWORD dwParam, RILADDRESS raRilAddress);

void ActiveIFALLHOLD();
void HoldIfAllActive();
BOOL A2DPIoControl(DWORD Msg, DWORD op);
DWORD GetBTState(void);


